#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=998244353;
const int maxn=2e7+5;
ll N,n,m,ans,p[maxn],inv[maxn],pm[maxn],add;
ll C(ll x,ll y)
{
    if(x<y) return 0;
    return p[x]*(inv[y]*inv[x-y]%mod)%mod;
}
ll qp(ll x,ll y)
{
    ll ret=1;
    while(y)
    {
        if(y&1) ret=ret*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return ret;
}
int pr[maxn],num;
int main()
{
    freopen("drama.in","r",stdin);
    freopen("drama.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m;
    if(m<n) n=m;
    p[0]=pm[1]=1;
    for(int i=1;i<=n;i++) p[i]=p[i-1]*i%mod;
    inv[n]=qp(p[n],mod-2);
    for(int i=n;i>=1;i--) inv[i-1]=inv[i]*i%mod;
    for(int i=2;i<=n;i++)
    {
        if(pm[i]==0) pm[i]=qp(i,m),pr[++num]=i;
        for(int j=1;j<=num && i*pr[j]<=n;j++)
        {
            pm[i*pr[j]]=pm[i]*pm[pr[j]]%mod;
            if(i%pr[j]==0) break;
        }
    }
    N=n;
    for(n=1;n<=N;n++)
    {
        add=0;
        for(int i=0;i<n;i++)
        {
            if(i%2==0) add=(add+C(n,i)*pm[n-i])%mod;
            if(i%2==1) add=(add-C(n,i)*pm[n-i])%mod;
        }
        ans=(ans+add*inv[n])%mod;
    }
    cout<<(ans%mod+mod)%mod<<'\n';
    return 0;
}
